1. Field of the Invention
The present invention relates to a method, system, and program for transferring data among a logical layer, physical layer, and storage device.
2. Description of the Related Art
In a storage environment, data may be transferred among heterogeneous storage devices, such as sequential access devices (e.g., tape drives, optical disk drives, etc.) or random access storage devices (e.g., hard disk drives, electronic memory, Flash memory, etc.) A system attached to the storage devices may have a logical layer presenting a logical view of chunks of the data, also referred to as logical blocks that may be included within or span physical blocks in the storage device. The logical layer calls a physical layer to access the storage device. Both the logical and physical layers may add header information to the application data that includes information used to manage the data and error checking codes. The physical header may indicate the amount of data written to the storage device in the block and the logical block identifier.
The logical layer may allocate a buffer in memory to include data being transferred to the storage device. The logical layer performs a memory copy operation to transfer the data from the logical layer buffer to a physical layer Input/Output (I/O) buffer in which the physical layer adds physical header information before transferring data to the storage device. For instance, the logical layer fills a buffer with application data and a logical header. The physical layer then adds a physical header to an Input/Output (I/O) buffer and copies the data in the buffer used by the logical layer to the I/O buffer following the physical header added to the I/O buffer.
To perform a read operation, the logical layer maintains information associating a physical location at which a logical object is stored with a logical block identifier. An object may span multiple logical and physical blocks, or multiple objects may be contained within a single block. To retrieve an object, the logical layer requests the physical layer to read the block at the physical location associated with the object. The physical layer determines an offset into the buffer including the physical location that skips the physical header, where the logical layer is not aware of the physical header. The physical layer then performs two operations, one to read the entire physical block containing the logical block and physical header into the I/O buffer and a second to memory copy the block from the offset into the I/O buffer that skips the physical header. This memory copy operation copies the logical header and application data in the I/O buffer to a buffer allocated to the logical layer.